ReactiveList class¶
Attributes: [DefaultMember("Item")] [DebuggerDisplay("Count = {Count}")]
Defined in
Namespace: ReactiveList.Reactive.Collections Assembly: ReactiveList.Reactive.dll Full name: ReactiveList.Reactive.Collections.ReactiveList<T> Modifiers: public sealed
Summary¶
View source (opens in a new tab)
Represents a thread-safe, observable list that provides reactive notifications for item additions, removals, and
changes.
Applies to
net11.0, net10.0, net47, net471, net472, net48, net481
Class hierarchy
classDiagram
class ReactiveList~T~
class IReactiveList~T~ {
<>
}
IReactiveList~T~ <|.. ReactiveList~T~
class IList~T~ {
<>
}
IList~T~ <|.. ReactiveList~T~
class ICollection~T~ {
<>
}
ICollection~T~ <|.. ReactiveList~T~
class IEnumerable~T~ {
<>
}
IEnumerable~T~ <|.. ReactiveList~T~
class IEnumerable {
<>
}
IEnumerable <|.. ReactiveList~T~
class IList {
<>
}
IList <|.. ReactiveList~T~
class ICollection {
<>
}
ICollection <|.. ReactiveList~T~
class IReadOnlyList~T~ {
<>
}
IReadOnlyList~T~ <|.. ReactiveList~T~
class IReadOnlyCollection~T~ {
<>
}
IReadOnlyCollection~T~ <|.. ReactiveList~T~
class IReactiveSource~T~ {
<>
}
IReactiveSource~T~ <|.. ReactiveList~T~
class INotifyCollectionChanged {
<>
}
INotifyCollectionChanged <|.. ReactiveList~T~
class IDisposable {
<>
}
IDisposable <|.. ReactiveList~T~
class INotifyPropertyChanged {
<>
}
INotifyPropertyChanged <|.. ReactiveList~T~
class IReactiveSourceWithOptions {
<>
}
IReactiveSourceWithOptions <|.. ReactiveList~T~
class IVersionedSnapshotSource~T~ {
<>
}
IVersionedSnapshotSource~T~ <|.. ReactiveList~T~
Implements: IReactiveList
Remarks¶
All public members are thread-safe. Mutations are applied under an internal lock, and notifications (CollectionChanged, PropertyChanged, Stream, CurrentItems and the observable collections) are queued in commit order and delivered after the lock is released by one thread at a time. A mutation made from inside a handler is therefore applied immediately but its notifications are delivered after the current handler returns, and a mutation made while another thread is delivering may return before its own notifications have been delivered. Predicates passed to RemoveMany and the action passed to Edit run under the lock, must not block on other threads, and must not mutate the list.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the ReactiveList class. |
Properties¶
| Name | Summary |
|---|---|
| Count | Gets the number of elements contained in the list. |
| IsDisposed | Gets a value indicating whether the source has been disposed. |
| IsFixedSize | Gets a value indicating whether the IList (opens in a new tab) has a fixed size. |
| IsReadOnly | Gets a value indicating whether the list is read-only. |
| IsSynchronized | Gets a value indicating whether access to the ICollection (opens in a new tab) is synchronized (thread safe). |
| Options | Gets the options that apply for the lifetime of the source. |
| Version | Gets the current version number of the collection, which is incremented on each modification. |
| SyncRoot | Gets an object that can be used to synchronize access to the ICollection (opens in a new tab). |
| this[] | Gets or sets the element at the specified index. |
| Added | Gets the added during the last change as an Observable. |
| Changed | Gets the changed during the last change as an Observable. |
| CurrentItems | Gets the current items as an observable that replays the latest snapshot to new subscribers. |
| Removed | Gets the removed items during the last change as an Observable. |
| Items | Gets a read-only observable mirror of the items. |
| ItemsAdded | Gets the items added during the last change. |
| ItemsChanged | Gets the items changed during the last change. |
| ItemsRemoved | Gets the items removed during the last change. |
| Stream | Gets an observable sequence that emits cache change notifications as they occur. |
| VersionedStream | Gets an observable of change notifications, each paired with the version the change produced. |
Methods¶
| Name | Summary |
|---|---|
| Add | Adds an item to the ICollection (opens in a new tab). |
| ToArray | Creates a snapshot of current items as an array. |
| CopyVersioned | Copies every item and reports the version of that copy. |
| AddRange | Adds a range of items from a ReadOnlySpan (opens in a new tab). |
| CopyTo | Copies the items to the specified span. |
| AsSpan | Gets a read-only span over a snapshot of the items. |
| AsMemory | Gets a read-only memory region over a snapshot of the items. |
| ClearWithoutDeallocation | Clears all items from the list; the internal array capacity is kept for reuse. |
| Clear | Removes all items from the ICollection (opens in a new tab). |
| Contains | Determines whether the ICollection (opens in a new tab) contains a specific value. |
| Edit | Applies several changes as one notification. |
| GetEnumerator | Returns an enumerator that iterates through the list. |
| IndexOf | Determines the index of a specific item in the IList (opens in a new tab). |
| Insert | Inserts an item to the IList (opens in a new tab) at the specified index. |
| InsertRange | Inserts a range of items at an index. |
| Move | Moves an item from one index to another. |
| Remove | Removes the first occurrence of a specific object from the ICollection (opens in a new tab). |
| RemoveMany | Removes all elements that match the specified predicate from the collection. |
| RemoveAt | Removes the IList (opens in a new tab) item at the specified index. |
| RemoveRange | Removes the range. |
| ReplaceAll | Replaces all existing items with new items. |
| Update | Updates the specified item. |
| Dispose | Releases the stream and observable resources; calling it more than once, or from several threads, is safe. |
| DeferNotifications | Defers change notifications until the last active deferral is disposed. |
| Subscribe | Subscribes the specified observer to the CurrentItems. |
Events¶
| Name | Summary |
|---|---|
| CollectionChanged | Occurs when the collection changes. |
| PropertyChanged | Occurs when a property value changes. |
Inherited members
System.Object.Equals(System.Object)(opens in a new tab)System.Object.Equals(System.Object,System.Object)(opens in a new tab)System.Object.GetHashCode(opens in a new tab)System.Object.GetType(opens in a new tab)System.Object.MemberwiseClone(opens in a new tab)System.Object.ReferenceEquals(System.Object,System.Object)(opens in a new tab)System.Object.ToString(opens in a new tab)